package com.example.system.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * author: adnaan
 * create: 2023-10-29 22:22
 * Description:
 */
@Configuration
public class MyWebMvcConfigurer extends WebMvcConfigurationSupport {

    @Value("${upload.path}")
    private String pathName;

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry
                // 虚拟路径
                .addResourceHandler("/show/**")
                // 真实路径
                .addResourceLocations("file:" + pathName);
    }
}
